﻿using System.Collections.ObjectModel;
using System.Linq;

namespace Effector.ViewModel
{
    /// <summary>
    /// The main view model and starter class.
    /// </summary>
    public class ExplorerModel
    {
        private ObservableCollection<LogicalDriveModel> _ldrives = null;

        /// <summary>
        /// Initializes a new instance of the <see cref="ExplorerModel"/> class.
        /// </summary>
        /// <param name="ldms">The LDMS.</param>
        public ExplorerModel(LogicalDriveModel[] ldms)
        {
            if(_ldrives == null)
                _ldrives = new ObservableCollection<LogicalDriveModel>(ldms.ToList());
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ExplorerModel"/> class.
        /// </summary>
        /// <param name="ldm">The LDM.</param>
        public ExplorerModel(LogicalDriveModel ldm)
        {
            if(_ldrives == null)
                _ldrives = new ObservableCollection<LogicalDriveModel>();
            _ldrives.Add(ldm);
        }

        /// <summary>
        /// Gets the logical drives.
        /// </summary>
        /// <value>The logical drives.</value>
        public ObservableCollection<LogicalDriveModel> LogicalDrives
        {
            get { return _ldrives; }
        }
    }
}
